<template>
  <div>
    <div class="recommend-title">商品列表</div>
    <ul>
      <li class="item border-bottom" v-for="item of list" :key="item.id">
        <div class="item-img-wrapper">
          <img class="item-img" :src="imgBaseURL + item.imgUrl" />
        </div>
        <div class="item-info">
          <p class="item-title">{{ item.title }}</p>
          <p class="item-desc">{{ item.desc }}</p>
          <router-link :to="'/detail/' + item.recommendId">
            <button class="item-more">查看详情</button>
          </router-link>
        </div>
      </li>
    </ul>
  </div>
</template>
<script>
/* eslint-disable */
export default {
  name: "HomeRecommend",
  data() {
    return {
      imgBaseURL: process.env.BASE_API,
    };
  },
  props: {
    list: Array,
  },
};
</script>
<style scoped>
.recommend-title {
  margin-top: 0.2rem;
  line-height: 0.8rem;
  background: #eee;
  text-indent: 0.2rem;
}

.item {
  overflow: hidden;
  display: flex;
  height: 1.9rem;
}

.item-img {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0.1rem;
}

.item-info {
  flex: 1;
  padding: 0.1rem;
  min-width: 0;
}

.item-info .item-title {
  line-height: 0.54rem;
  font-size: 0.32rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.item-info .item-desc {
  line-height: 0.4rem;
  color: #ccc;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.item-info .item-more {
  line-height: 0.6rem;
  margin-top: 0.16rem;
  background: #ff9300;
  padding: 0 0.2rem;
  border-radius: 0.05rem;
  color: #fff;
}
</style>
